import router from "@src/router";

Component({
  data: {
    remark: '',
    remarkLen: 0,
  },
  observers: {
    'remark': function (remark) {
      if (!remark) {
        this.setData({remarkLen: 0})
      } else {
        this.setData({remarkLen: remark.length})
      }
    }
  },
  methods: {
    onLoad(options) {
      let {remark} = options;
      this.setData({remark: remark})
    },
    handleInput(e) {
      this.setData({remark: e.detail.value})
    },
    handleConfirm() {
      const eventChannel = this.getOpenerEventChannel()
      eventChannel.emit('remarkChange', this.data.remark);
      router.back();
    }
  }
})
